﻿<UserControl x:Class="Signum.Windows.FilterLine"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:m="clr-namespace:Signum.Windows"
             xmlns:dq="clr-namespace:Signum.Entities.DynamicQuery;assembly=Signum.Entities"
             mc:Ignorable="d">
    <Grid HorizontalAlignment="Left" Margin="0,0,0,4">
        <Grid.ColumnDefinitions>
            <ColumnDefinition  SharedSizeGroup="GrColEliminar"/>
            <ColumnDefinition  SharedSizeGroup="GrColField"/>
            <ColumnDefinition  SharedSizeGroup="GrColOperation"/>
            <ColumnDefinition  SharedSizeGroup="GrColValue"/>
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" x:Name="btRemove" Style="{StaticResource RoundButton}" Content="{StaticResource Remove}" HorizontalAlignment="Right"  VerticalAlignment="Center" Visibility="{Binding Frozen, Converter={x:Static m:Converters.NotBoolToVisibility}}" Click="btRemove_Click" Margin="2,0"/>
        <m:QueryTokenRenderer Grid.Column="1" Token="{Binding Token}"   VerticalAlignment="Center"  Margin="0,0,8,0" />
        <ComboBox Grid.Column="2"
                                        SelectedItem="{Binding Operation}" 
                                        ItemsSource="{Binding Token, Converter={x:Static m:Converters.TokenOperations}}"
                                        IsEnabled="{Binding Frozen, Converter={x:Static m:Converters.Not}}"
                                       VerticalAlignment="Center"
                                      Margin="0,0,8,0">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Converter={x:Static m:Converters.EnumDescriptionConverter}}"  VerticalAlignment="Center" Margin="0,0,8,0"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <Grid Grid.Column="3" Loaded="Grid_Loaded" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0,0,8,0"/>
    </Grid>
</UserControl>
